package com.gh.rabbitmq.eight;

import com.gh.rabbitmq.utils.RabbitmqUtils;
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;

/**
 * @Author Eric
 * @Date 2021/7/18 18:21
 * @Version 1.0
 * 死信队列生产者
 */
public class Producer {
    //普通交换机名称
    public static final String NORMAL_EXCHANGE="normal_exchange";

    public static void main(String[] args) throws Exception{
        Channel channel = RabbitmqUtils.getChannel();
        //死信消息 设置ttl时间
//        AMQP.BasicProperties properties=new AMQP.BasicProperties()
//                .builder().expiration("10000").build();
        for (int i = 1; i < 11; i++) {
            String message="info"+i;
            channel.basicPublish(NORMAL_EXCHANGE,"zhangsan",null,message.getBytes());
        }
    }
}
